package com.fxpc.hddc.activefaultposit.jpa.dao.primary;


import com.fxpc.hddc.activefaultposit.dto.primary.entity.HddcActivefaultPositionerrorEntity;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.time.LocalDate;
import java.util.List;


/**
 * @author zyb
 * @date 2020-11-30
 */
@Repository
public interface ActivefaultPositionerrorBaseDao extends JpaRepository<HddcActivefaultPositionerrorEntity, String> {

    @Query(nativeQuery = true, value = "select * from hddc_activefault_positionerror where SUBSTRING(create_time,1,10)= :nowDay AND is_valid = 1")
    List<HddcActivefaultPositionerrorEntity> findOneDayDataByCreateTime(@Param(value = "nowDay") LocalDate nowDay);

    @Query(nativeQuery = true, value = "select * from hddc_activefault_positionerror where is_valid = 1")
    List<HddcActivefaultPositionerrorEntity> findAllTime();

    Long count(Specification<HddcActivefaultPositionerrorEntity> specification);




}
